package com.wms.config.controller;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;

import com.common.api.annontation.ServiceLog;
import com.common.api.model.PageModel;
import com.wms.config.api.service.DeviceService;
import com.wms.config.api.dto.DeviceDto;

import com.common.web.annotation.ControllerRequest;
import com.common.web.dto.request.FuzzyPageDTO;
import com.common.web.dto.response.RestResponse;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;

/**
 * <p>
 * 设备信息前端控制器
 * </p>
 *
 * @author system
 * @since 2024-09-12 15:44:44
 */
@ServiceLog
@ControllerRequest("/device/")
@Api(tags = "设备信息服务接口")
public class DeviceController {

	@Autowired
	private DeviceService deviceService;
	
	/**
	 * @param fuzzyPageDTO
	 * @return
	 */
    @RequestMapping(value="queryList")
    @ApiOperation(value = "查询设备信息集合")
    public RestResponse queryList(@RequestBody FuzzyPageDTO fuzzyPageDTO) {
      	PageModel<DeviceDto> page= deviceService.queryList(fuzzyPageDTO);
        return RestResponse.success("查询设备信息集合成功!").setData(page);
    }

	/**
	 * @param id
	 * @return
	 */
	@RequestMapping(value="get")
	@ApiOperation(value ="根据主键查询设备信息")
    public RestResponse get(@RequestBody String id) {
		DeviceDto dto= deviceService.get(id);	
		return RestResponse.success("根据主键查询设备信息成功!").setData(dto);
    }	
	
	/**
	 * @param ${entity}Dto
	 * @return
	 */
	@RequestMapping(value="add")
	@ApiOperation(value ="新增保存设备信息")
    public RestResponse add(@RequestBody DeviceDto dto) {
		int count= deviceService.add(dto);	
        return RestResponse.success("保存设备信息成功!").setData(count);
    }
    
	/**
	 * @param ${entity}Dto
	 * @return
	 */
	@RequestMapping(value="modify")
	@ApiOperation(value ="修改保存设备信息")
    public RestResponse modify(@RequestBody DeviceDto dto) {
		int count= deviceService.modify(dto);	
        return RestResponse.success("保存设备信息成功!").setData(count);
    }
        	
	/**
	 * @param idList
	 * @return
	 */
	@RequestMapping(value="dels")
	@ApiOperation(value ="根据主键批量删除设备信息")
    public RestResponse dels(@RequestBody List<String> idList) {
		int count= deviceService.dels(idList);	
		return RestResponse.success("根据主键批量删除设备信息成功!").setData(count);
    }
	
}
